<template>
  <div
    id="app"
    style="background: #fff"
    :class="$route.query.applicationId == '586907411135073797' ? 'appB' : ''"
  >
    <router-view />
  </div>
</template>

<script>
const beforeUnload = function (e) {
  e = e || window.event;
  if (e || window.event) e.returnValue = 1;
  return 1;
};
export default {
  name: "App",
  mounted() {
    this.$nextTick(() => {
      window.addEventListener("beforeunload", beforeUnload);
    });
  },
  beforeDestroy() {
    window.removeEventListener("beforeunload", beforeUnload);
  },
  created() {
    var ua = navigator.userAgent.toLowerCase();
    var isWeixin = ua.indexOf("micromessenger") !== -1;
    if (isWeixin) {
      localStorage.removeItem("loginCode");
      localStorage.removeItem("_stateArr");
      if (this.getUrlParam("code")) {
        localStorage.setItem("loginCode", this.getUrlParam("code"));
      }
      if (this.getStateAll()) {
        localStorage.setItem("_stateArr", JSON.stringify(this.getStateAll()));
      }
    }
  },
  methods: {
    getUrlParam(key) {
      var href = window.location.href;
      var url = href.split("?");
      if (url.length <= 1) {
        return "";
      }
      var params = url[1].split("&");

      for (var i = 0; i < params.length; i++) {
        var param = params[i].split("=");
        if (key == param[0]) {
          console.log(param[1], "param[1]");
          return param[1];
        }
      }
    },
    getStateAll() {
      const _state = this.getUrlParam("state"); // wwc0366cea7d993696_1000034 或 wwc0366cea7d993696_1000034#/login
      const _stateArr = _state.split("#")[0].split("_");
      return {
        corpId: _stateArr[0],
        agentId: _stateArr[1],
      };
    },
  },
};
</script>
<style>
.appB {
  height: auto !important;
  overflow-x: hidden;
  overflow-y: auto;
}
.refInput.el-input--small .el-input__inner {
  line-height: 90px !important;
  height: 90px !important;
  border: 1px solid #E2E7F5 !important;
}
.refInput.cIdxs.el-input--small .el-input__inner {
  line-height: 40px !important;
  height: 40px !important;
}
.inputWraps img {
  width: 160px !important;
  height: 90px !important;
  border-radius:3px !important;
}
.inputCIdxs img {
  width: 64px !important;
  height: 40px !important;
  border-radius:3px !important;
}
.search-form .formRight {
  display: flex;
  justify-content: end;
}
.set-table-btn-col.disabled i.el-icon-my-message {
  filter: grayscale(100%) !important;
}

.formLeft .el-col .el-form-item--small .el-form-item__label {
  color: #323232;
}
.table-form .el-table td.el-table__cell div {
  color: #4D4D4D;
}

/* 修改确认按钮样式 */
.el-button--primary {
  background-color: #2265ee !important;
  border-color: #2265ee !important;
  width: 104px;
  height: 36px;
}
.el-button--default {
  width: 104px;
  height: 36px;
}
.el-button span {
  font-size: 13px !important;
}
.el-checkbox__input.is-checked .el-checkbox__inner, .el-checkbox__input.is-indeterminate .el-checkbox__inner {
    background-color: #2265ee !important;
    border-color: #2265ee !important;
}
.el-radio__input.is-checked+.el-radio__label, .el-radio {
    color: #536387 !important;
}
.el-radio__input.is-checked .el-radio__inner {
    border-color: #2265ee !important;
    background: #2265ee !important;
}

</style>
